package test00.lx05.test06;

import java.util.function.Function;

/**
 * @author CSY
 * @date 2025 - 04 - 07
 */
public class MainTest {
    public static void main(String[] args) {
        //   R apply(T t);
        Function<String, Student> function = (t) -> {
            String[] split = t.split(",");
            if (split.length == 2 && split[1].matches("^\\d+$")) {
                return new Student(split[0],Integer.parseInt(split[1]));
            }
            return null;
        };
        Student stu = function.apply("张三,18");
        System.out.println(stu);
        if (stu != null) {
            int i = stu.getAge() + 1;
        }
    }
}
